import java.lang.*;
import java.util.*;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;

import mastermind.gui.Frame;

public class Game {
	public static final int port = 2011;
	public static final String host = "127.0.0.1";
	private socketConnect sockets;
	mode theMode;
	
	enum mode {
		NOTCONNECTED, ISLOGGINGIN, ISREGISTERING, LOGGEDIN, REGISTERED, INGAME, GAMEOVER, DISCONNECTED, CLIENTQUIT,SERVERQUIT
	}
	
	boolean doConnect() {
		sockets = new socketConnect(host,port);
	}
	
	void start() {
		doConnect();
		
		while(theMode != mode.CLIENTQUIT) {
			presentSplash();
			
			if(theMode == mode.ISLOGGINGIN) {
				presentLogin();
			} else if(theMode == mode.ISREGISTERING) {
				presentRegister();
				presentSplash(); // go back to the start so they can login
			}
			
			while(theMode == mode.INGAME) {
				askGuess();
				doTick();
			}
			
			showResults();
			showLeaderboard();
		}
	}
	Game() {
		
	}
}
